import FastIntegerCompression from 'fastintcompression'

{compress,uncompress} = FastIntegerCompression

# 版本号
# 命令指令
# 操作指令长度

export dump = (li)=>
  b = Buffer.from compress li
  Buffer.concat [b, Buffer.from([b.length])]

export load = (msg)=>
  length = msg.length - 1
  len = length - msg[length]
  r = uncompress(msg[len...length])
  [
    r
    msg[...len]
  ]


